#pragma once
#include <vector>

using namespace std;

namespace firstUniqChar
{
	class Solution {
	public:
		int firstUniqChar(string s) {
			int flag[26] = { 0 };
			for (int i = 0; i < s.length(); i++)
			{
				flag[s[i] - 'a']++;
			}
			for (int i = 0; i < s.length(); i++)
			{
				if (flag[s[i] - 'a'] == 1)
				{
					return i;
				}
			}
			return -1;
		}
	};
}